package com.xy.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Cacheable;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/*
 * 函授站领书
 */
@SuppressWarnings("serial")
@Entity
@Table
@Cacheable
public class DeliverToStation extends Identified implements Serializable {

	private Date deliverDate;// 发放日期
	private int amount;// 数量
	// 对应管理表
	@ManyToOne(targetEntity = Admin.class)
	@JoinColumn(name = "Admin_Id", referencedColumnName = "id")
	@Cascade(CascadeType.SAVE_UPDATE)
	private Admin admin;
	// 对应到函授站
	@OneToOne(targetEntity = Station.class)
	@JoinColumn(name = "Station_id", referencedColumnName = "id")
	private Station station;
	// 对应到教材表
	@ManyToOne(targetEntity = TextBook.class) // 教材
	@JoinColumn(name = "TextBook_id", referencedColumnName = "id")
	@Cascade(CascadeType.SAVE_UPDATE)
	private TextBook textBook;

	public Date getDeliverDate() {
		return deliverDate;
	}

	public void setDeliverDate(Date deliverDate) {
		this.deliverDate = deliverDate;
	}

	public Admin getAdmin() {
		return admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}

	public Station getStation() {
		return station;
	}

	public void setStation(Station station) {
		this.station = station;
	}

	public TextBook getTextBook() {
		return textBook;
	}

	public void setTextBook(TextBook textBook) {
		this.textBook = textBook;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	public DeliverToStation() {
		super();
		// TODO Auto-generated constructor stub
	}

}
